package com.nuaa.community.entity;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import org.springframework.data.elasticsearch.annotations.Setting;

import java.util.Date;

/**
 * ClassName: DiscussPost
 * Package: com.nuaa.community.entity
 * Description:
 */
@Document(indexName = "discusspost")
@Setting(shards = 6, replicas = 3)
@Data
public class DiscussPost {

    @Id
    private int id;               //帖子id

    @Field(type = FieldType.Integer)
    private int userId;           //用户id

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String title;         //帖子标题

    @Field(type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String content;       //帖子内容

    @Field(type = FieldType.Integer)
    private int type;             //帖子类型（0-普通；1-置顶）

    @Field(type = FieldType.Integer)
    private int status;           //帖子状态(0-正常；1-精华；2-拉黑）

    @Field(type = FieldType.Date)
    private Date createTime;      //帖子创建时间

    @Field(type = FieldType.Integer)
    private int commentCount;     //帖子评论数量

    @Field(type = FieldType.Double)
    private double score;         //帖子分数（为后面帖子排名用）
}
